home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / util / rexx / FontCataloguer.lha / FontCatalogue.rexx next >
OS/2 REXX Batch file  |  1995-07-05  |  2KB  |  85 lines

  1.  
  2. /* -------------------------------------------------------------*/
  3. /*                                */
  4. /* Final Writer 3 Arexx Macro - FontCatalogue             */
  5. /* ©1994 Marcin Orîowski                    */
  6. /*                                */
  7. /* E-mail: carlos@felix.univ.szczecin.pl            */
  8. /*                                */
  9. /* This macro will display all fonts from selected font drawer  */
  10. /* by its name written twice - once using standard font and     */
  11. /* then using font itself to show how the font looks like       */
  12. /* You can type your own pattern to filter those fonts you want */
  13. /*                                */
  14. /* -------------------------------------------------------------*/
  15.  
  16. address "FINALW.1"
  17. options results
  18.  
  19. NL = '0A'X
  20. TempFile = "T:FWFontCatalogue"
  21.  
  22. 'status FontPath'
  23. FontName = Result
  24.  
  25. pos = LASTPOS('/', FontName)
  26. IF ( pos ~= 0 ) 
  27. then    /* If we found it, then DELSTR */
  28.     FontPath = DELSTR(FontName, pos)
  29. ELSE     DO /* If no '/' is found, then search for ':' (volume name) */
  30.     pos = LASTPOS(':', FontName)
  31.     IF ( pos ~= 0 ) 
  32.     THEN    /* If we found it, then DELSTR */
  33.         FontPath = DELSTR(FontName, pos + 1)
  34.     ELSE     EXIT 20
  35.     END
  36.  
  37. 'RequestText "Path selection..." "Select font path" "' FontPath '"'
  38. FontPath = Result
  39. 'RequestText "Font pattern..." "Select font pattern" "#?.pfb"'
  40. FontPattern = Result
  41.  
  42. address command 'list ' FontPath || ' to=' TempFile || ' pat=' || FontPattern || ' files lformat "%s%s"'
  43. address command 'sort ' Tempfile Tempfile
  44.  
  45. IF ~OPEN('infile', TempFile, "R")
  46. THEN
  47. EXIT 10
  48.  
  49. DO WHILE 1                /* DO Forever - We'll EXIT on EOF) */
  50.     FullFontName = ReadLn('infile')
  51.     IF EOF('infile') THEN EXIT 20
  52.  
  53.     IF LENGTH(FullFontName) = 0 
  54.         THEN     Iterate
  55.         /* We'll strip the path from the name for display */
  56.         pos = LASTPOS('/', FullFontName)
  57.  
  58.     IF ( pos ~= 0 ) 
  59.     THEN    /* If we found it, then DELSTR */
  60.         FontName = RIGHT(FullFontName, LENGTH(FullFontName) - pos)
  61.     ELSE     DO
  62.         pos = LASTPOS(':', FullFontName)
  63.         IF ( pos ~= 0 ) 
  64.         THEN    /* If we found it, then DELSTR */
  65.             FontName = Right(FullFontName, LENGTH(FullFontName) - pos)
  66.         ELSE
  67.              EXIT 20
  68.         END
  69.  
  70.     'Font ' || FullFontName        /* make sure we can use it */
  71.     IF RC = 0 
  72.     THEN    DO
  73.         'FontSize 14'
  74.         'Font SoftSans'      /* We'll always display the font name in SoftSans */
  75.         'Type ' || FontName
  76.         'Type         '     /* 2 TABs are here! */
  77.         'Font ' || FullFontName
  78.         'FontSize 36' 
  79.         'Type ' || FontName
  80.         'NewParagraph'
  81.         END
  82. END
  83.  
  84. address command 'delete >nil: ' Tempfile
  85.